<!--#include file="./doctype.html"-->
<title>栏目管理-<%=siteTitle%>-后台管理</title>
</head><body>
<div class="wrap">
    <ol class="breadcrumb">
        <li class="active"><a href="<%=fileName%>">列表首页</a></li>
    </ol>
	<form method="get" action="<%=fileName%>" class="mb10" role="form">
		<input type="hidden" value="index" name="q">
		<div class="form-group">
            <div class="inline w20 genre_id" data-name="genreID" data-id="<%=genreID%>"></div>
            <button type="submit" class="btn btn-sm btn-primary inline">确定</button>
        </div>
	</form>
	<% if isArray(data) then %>
		<table class="table table-bordered">
			<thead>
				<tr>
					<th>id</th>
					<th>名称</th>
					<th>所属大类</th>
					<th>栏目模板ID</th>
					<th>栏目之内容页面模板ID</th>
					<th>启用？</th>
				</tr>
			</thead>
			<tbody>
			<% for i = 0 to ubound(data, 2) %>
				<% Tid = data(0,i) %>
				<tr>
					<td><label><input type="checkbox" name="batchId" value="<%=Tid%>" /> <%=Tid%></label></td>
					<td><a href="<%=fileName%>?q=edit&id=<%=Tid%>"><%=data(1,i)%></a></td>
					<td class="genre_name" data-id="<%=data(2,i)%>"></td>
					<td><a href="./view.asp?q=edit&id=<%=data(3,i)%>">修改[<%=data(3,i)%>]</a></td>
					<td><a href="./view.asp?q=edit&id=<%=data(4,i)%>">修改[<%=data(4,i)%>]</a></td>
					<td class="setBool" data-value="<%=data(5,i)%>"></td>
				</tr>
			<% next %>
			</tbody>
		</table>
		<!--#include file="page.html"-->
		<div class="btn-group">
            <span class="btn btn-sm btn-default selectAll">
                <i class="glyphicon glyphicon-th"></i> 全选/反选
            </span>
            <span class="btn btn-sm btn-default deleteBatch">
                <i class="glyphicon glyphicon-trash"></i> 删除
            </span>
            <span class="btn btn-sm btn-default statusBatch" data-status="0">
                <i class="glyphicon glyphicon-ok"></i> 启用
            </span>
            <span class="btn btn-sm btn-default statusBatch" data-status="1">
                <i class="glyphicon glyphicon-minus-sign"></i> 禁用
            </span>
            <span class="btn btn-sm btn-default editBatch">
                <i class="glyphicon glyphicon-edit"></i> 修改
            </span>
        </div>
	<% else %>
		<!--#include file="noData.html"-->
	<% End if %>
    <!--#include file="loadTime.html"-->
</div>
<script>
$(document).ready(function(){
    $('.setBool').setBool(0);
    $('.genre_id').getKind({
        url: './ajax.asp?q=getGenre',
        type: 'checkbox',
        callback: function(a) {
            var cache = {};
            $.each(a, function(i, n) {
                cache['c'+n[0]] = n[2];
            });
            $('.genre_name').each(function(i) {
                var self = $(this), id = self.attr('data-id');
                cache['c'+id] && self.html(cache['c'+id]);
            });
        }
    });
$(this)
	.on('click', '.statusBatch', function() {
		$(this).statusBatch();
	})
	.on('click', '.deleteBatch', function() {
		$.deleteBatch();
	})
	.on('click', '.editBatch', function() {
		$.editBatch();
	})
});
</script>
</body>
</html>